package com.google.android.gms.internal;

import java.io.IOException;

public final class zzjl extends zzflm<zzjl> {
    private String zzbes = null;
    private Integer zzbet = null;
    private int[] zzbeu = zzflv.zzpvy;
    private zzju zzbev = null;

    public zzjl() {
        this.zzpvl = null;
        this.zzpnr = -1;
    }

    /* access modifiers changed from: private */
    /* renamed from: zzn */
    public final zzjl zza(zzflj zzflj) throws IOException {
        while (true) {
            int zzcxx = zzflj.zzcxx();
            if (zzcxx == 0) {
                return this;
            }
            if (zzcxx == 10) {
                this.zzbes = zzflj.readString();
            } else if (zzcxx == 16) {
                int position = zzflj.getPosition();
                try {
                    this.zzbet = Integer.valueOf(zzjc.zzd(zzflj.zzcym()));
                } catch (IllegalArgumentException unused) {
                    zzflj.zzmw(position);
                    zza(zzflj, zzcxx);
                }
            } else if (zzcxx == 24) {
                int zzb = zzflv.zzb(zzflj, 24);
                int length = this.zzbeu == null ? 0 : this.zzbeu.length;
                int[] iArr = new int[(zzb + length)];
                if (length != 0) {
                    System.arraycopy(this.zzbeu, 0, iArr, 0, length);
                }
                while (length < iArr.length - 1) {
                    iArr[length] = zzflj.zzcym();
                    zzflj.zzcxx();
                    length++;
                }
                iArr[length] = zzflj.zzcym();
                this.zzbeu = iArr;
            } else if (zzcxx == 26) {
                int zzli = zzflj.zzli(zzflj.zzcym());
                int position2 = zzflj.getPosition();
                int i = 0;
                while (zzflj.zzcyo() > 0) {
                    zzflj.zzcym();
                    i++;
                }
                zzflj.zzmw(position2);
                int length2 = this.zzbeu == null ? 0 : this.zzbeu.length;
                int[] iArr2 = new int[(i + length2)];
                if (length2 != 0) {
                    System.arraycopy(this.zzbeu, 0, iArr2, 0, length2);
                }
                while (length2 < iArr2.length) {
                    iArr2[length2] = zzflj.zzcym();
                    length2++;
                }
                this.zzbeu = iArr2;
                zzflj.zzlj(zzli);
            } else if (zzcxx == 34) {
                if (this.zzbev == null) {
                    this.zzbev = new zzju();
                }
                zzflj.zza(this.zzbev);
            } else if (!super.zza(zzflj, zzcxx)) {
                return this;
            }
        }
    }

    public final void zza(zzflk zzflk) throws IOException {
        if (this.zzbes != null) {
            zzflk.zzp(1, this.zzbes);
        }
        if (this.zzbet != null) {
            zzflk.zzad(2, this.zzbet.intValue());
        }
        if (this.zzbeu != null && this.zzbeu.length > 0) {
            for (int zzad : this.zzbeu) {
                zzflk.zzad(3, zzad);
            }
        }
        if (this.zzbev != null) {
            zzflk.zza(4, (zzfls) this.zzbev);
        }
        super.zza(zzflk);
    }

    /* access modifiers changed from: protected */
    public final int zzq() {
        int zzq = super.zzq();
        if (this.zzbes != null) {
            zzq += zzflk.zzq(1, this.zzbes);
        }
        if (this.zzbet != null) {
            zzq += zzflk.zzag(2, this.zzbet.intValue());
        }
        if (this.zzbeu != null && this.zzbeu.length > 0) {
            int i = 0;
            for (int zzlx : this.zzbeu) {
                i += zzflk.zzlx(zzlx);
            }
            zzq = zzq + i + (1 * this.zzbeu.length);
        }
        return this.zzbev != null ? zzq + zzflk.zzb(4, (zzfls) this.zzbev) : zzq;
    }
}
